package ru.ifmo.swing.genetics.config.common;

import ru.ifmo.common.Source;

import javax.swing.text.JTextComponent;

/**
 * @author avhaliullin
 */
public class TextComponentIntegerSource implements Source<Integer> {
    private final JTextComponent textComponent;

    public TextComponentIntegerSource(JTextComponent textComponent) {
        this.textComponent = textComponent;
    }

    public Integer create() {
        return Integer.parseInt(textComponent.getText());
    }
}
